package development.bussiness;

import state.socket.DataPackage;
import development.Global;
import development.bean.User;

public class RankingBussiness {
  public void onGetTopRickest(DataPackage dataPackage) {
    Global.topRickest.removeAllElements();
    int size = dataPackage.nextInt();
    for (int i = 0; i < size; i++) {
      User user = new User(dataPackage.nextString());
      user.setMoney(dataPackage.nextInt());
      user.setGold(dataPackage.nextInt());
      Global.topRickest.addElement(user);
    }
  }
  
  public void onGetTopLevel(DataPackage dataPackage) {
    Global.topLevel.removeAllElements();
    int size = dataPackage.nextInt();
    for (int i = 0; i < size; i++) {
      User user = new User(dataPackage.nextString());
      user.setLevel(dataPackage.nextInt());
      Global.topLevel.addElement(user);
    }
  }
}
